//
//  BlankView.m
//  dangxiao_new
//
//  Created by 段帅 on 16/9/28.
//  Copyright © 2016年 newfuture. All rights reserved.
//

#import "BlankView.h"
#define SIZEWIDTH   [[UIScreen mainScreen] bounds].size.width
#import "SCToolManager.h"
@interface BlankView ()

@end

@implementation BlankView

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        [self createUI];
    }
    return self;
    
}

-(void)createUI{
    
    _icon = [[UIImageView alloc]initWithFrame:CGRectMake(SIZEWIDTH/2-34, 128, 68, 84)];
    _icon.image = [SCToolManager imageWithName:@"空白页" InBundle:@"ToolImage"  className:[self class]];
    _label = [[UILabel alloc]initWithFrame:CGRectMake(0, CGRectGetMaxY(_icon.frame)+25, SIZEWIDTH, 20)];
    _label.font = [UIFont systemFontOfSize:18];
    _label.textColor = [UIColor colorWithWhite:0.74 alpha:1];
    _label.text = @"暂无课程";
    _label.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_icon];
    [self addSubview:_label];
    self.backgroundColor = [UIColor colorWithRed:245/255.0 green:245/255.0 blue:245/255.0 alpha:1];
    
}

-(void)adjustGapWithFrame:(CGRect)frame{
    _icon.frame = CGRectMake(SIZEWIDTH/2-30, frame.size.height/2-129/2, 68, 84);
    _label.frame = CGRectMake(0, CGRectGetMaxY(_icon.frame)+25, SIZEWIDTH, 20);
}
-(void)adjustGapWithHeight:(CGFloat)height{
    _icon.frame = CGRectMake(SIZEWIDTH/2-34, height/2-129/2, 68, 84);
    _label.frame = CGRectMake(0, CGRectGetMaxY(_icon.frame)+25, SIZEWIDTH, 20);
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
